bitkeeper revision 1.55 (3e4f9af1gsfKUo4Lbpb4s7Zx6hWWrw)
authorkaf24@labyrinth.cl.cam.ac.uk <kaf24@labyrinth.cl.cam.ac.uk>
Sun, 16 Feb 2003 14:06:41 +0000 (14:06 +0000)
committerkaf24@labyrinth.cl.cam.ac.uk <kaf24@labyrinth.cl.cam.ac.uk>
Sun, 16 Feb 2003 14:06:41 +0000 (14:06 +0000)
schedule.c, setup.c, process.c:
  Fixed SMP domain building.

xen-2.4.16/arch/i386/process.c
xen-2.4.16/arch/i386/setup.c
xen-2.4.16/common/schedule.c

index d3cedf47666509da191ed7394448575d75d6bdfe..665bd84d044ed702ee326a9ecd24ebebf642927a 100644 (file)
@@ -68,7 +68,10 @@ static void default_idle(void)
 void cpu_idle (void)
 {
     ASSERT(current->domain == IDLE_DOMAIN_ID);
+
     current->has_cpu = 1;
+    (void)wake_up(current);
+    schedule();
 
     /*
      * Declares CPU setup done to the boot processor.
index ad33a1e843063bf1ca9995ae71435766c272aabc..b5618485ecee86405d1e85b3daad7a2a087e0670 100644 (file)
@@ -227,9 +227,6 @@ void __init cpu_init(void)
     mapcache[nr] = (unsigned long *)get_free_page(GFP_KERNEL);
     clear_page(mapcache[nr]);
     *pl2e = mk_l2_pgentry(__pa(mapcache[nr]) | PAGE_HYPERVISOR);
-
-    /* Stick the idle task on the run queue. */
-    (void)wake_up(current);
 }
 
 static void __init do_initcalls(void)
index 289e69374bfb2208ca205e3268ecfb57feb020ae..d3ef9a88fc913fbc56176ce8b065df04179eef61 100644 (file)
@@ -93,7 +93,7 @@ void sched_add_domain(struct task_struct *p)
  */
 void sched_rem_domain(struct task_struct *p) 
 {
-       p->state = TASK_DYING;
+    p->state = TASK_DYING;
 }
 
 
@@ -183,9 +183,7 @@ long do_sched_op(void)
     return 0;
 }
 
-/*
- * 
- */
+
 void reschedule(struct task_struct *p)
 {
     int cpu = p->processor;
@@ -226,7 +224,7 @@ asmlinkage void schedule(void)
 
     spin_lock_irq(&schedule_data[this_cpu].lock);
 
-    //ASSERT(!in_interrupt());
+    /*ASSERT(!in_interrupt());*/
     ASSERT(__task_on_runqueue(prev));
 
        __move_last_runqueue(prev);
@@ -275,7 +273,7 @@ asmlinkage void schedule(void)
     if ( prev->state == TASK_DYING ) release_task(prev);
 
  same_process:
-       update_dom_time(current->shared_info);
+    update_dom_time(current->shared_info);
 
     if ( test_bit(_HYP_EVENT_NEED_RESCHED, &current->hyp_events) )
         goto need_resched_back;
@@ -288,50 +286,50 @@ asmlinkage void schedule(void)
 static __cacheline_aligned int count[NR_CPUS];
 static void sched_timer(unsigned long foo)
 {
-       int                             cpu  = smp_processor_id();
+    int                                cpu  = smp_processor_id();
     struct task_struct *curr = schedule_data[cpu].curr;
-       s_time_t                        now;
-       int                             res;
-
-       /* reschedule after each 5 ticks */
-       if (count[cpu] >= 5) {
-               set_bit(_HYP_EVENT_NEED_RESCHED, &curr->hyp_events);
-               count[cpu] = 0;
-       }
-       count[cpu]++;
-
-       /*
-     * deliver virtual timer interrups to domains if we are CPU 0
-     * XXX RN: We don't have a per CPU list of domains yet. Otherwise 
-     * would use that. Plus, this should be removed anyway once
-     * Domains "know" about virtual time and timeouts. But, it's better
-     * here then where it was before.
+    s_time_t                   now;
+    int                                res;
+
+    /* reschedule after each 5 ticks */
+    if (count[cpu] >= 5) {
+        set_bit(_HYP_EVENT_NEED_RESCHED, &curr->hyp_events);
+        count[cpu] = 0;
+    }
+    count[cpu]++;
+
+    /*
+     * deliver virtual timer interrups to domains if we are CPU 0 XXX RN: We
+     * don't have a per CPU list of domains yet. Otherwise would use that.
+     * Plus, this should be removed anyway once Domains "know" about virtual
+     * time and timeouts. But, it's better here then where it was before.
      */
-       if (cpu == 0) {
-               struct task_struct *p;
-               unsigned long cpu_mask = 0;
-
-               /* send virtual timer interrupt */
-               read_lock(&tasklist_lock);
-               p = &idle0_task;
-               do {
-                       cpu_mask |= mark_guest_event(p, _EVENT_TIMER);
-               }
-               while ( (p = p->next_task) != &idle0_task );
-               read_unlock(&tasklist_lock);
-               guest_event_notify(cpu_mask);
-       }
+    if (cpu == 0) {
+        struct task_struct *p;
+        unsigned long cpu_mask = 0;
+
+        /* send virtual timer interrupt */
+        read_lock(&tasklist_lock);
+        p = &idle0_task;
+        do {
+            if ( is_idle_task(p) ) continue;
+            cpu_mask |= mark_guest_event(p, _EVENT_TIMER);
+        }
+        while ( (p = p->next_task) != &idle0_task );
+        read_unlock(&tasklist_lock);
+        guest_event_notify(cpu_mask);
+    }
 
  again:
-       now = NOW();
-       s_timer[cpu].expires  = now + MILLISECS(10);
-       res=add_ac_timer(&s_timer[cpu]);
+    now = NOW();
+    s_timer[cpu].expires  = now + MILLISECS(10);
+    res=add_ac_timer(&s_timer[cpu]);
 
-       TRC(printk("SCHED[%02d] timer(): now=0x%08X%08X timo=0x%08X%08X\n",
-                          cpu, (u32)(now>>32), (u32)now,
-                          (u32)(s_timer[cpu].expires>>32), (u32)s_timer[cpu].expires));
-       if (res==1)
-               goto again;
+    TRC(printk("SCHED[%02d] timer(): now=0x%08X%08X timo=0x%08X%08X\n",
+               cpu, (u32)(now>>32), (u32)now,
+               (u32)(s_timer[cpu].expires>>32), (u32)s_timer[cpu].expires));
+    if (res==1)
+        goto again;
 
 }
 
@@ -343,7 +341,7 @@ void __init scheduler_init(void)
 {
     int i;
 
-       printk("Initialising schedulers\n");
+    printk("Initialising schedulers\n");
 
     for ( i = 0; i < NR_CPUS; i++ )
     {
@@ -352,9 +350,9 @@ void __init scheduler_init(void)
         schedule_data[i].prev = &idle0_task;
         schedule_data[i].curr = &idle0_task;
                
-               /* a timer for each CPU  */
-               init_ac_timer(&s_timer[i]);
-               s_timer[i].function = &sched_timer;
+        /* a timer for each CPU  */
+        init_ac_timer(&s_timer[i]);
+        s_timer[i].function = &sched_timer;
     }
 }
 
@@ -362,11 +360,11 @@ void __init scheduler_init(void)
  * Start a scheduler for each CPU
  * This has to be done *after* the timers, e.g., APICs, have been initialised
  */
-void schedulers_start(void) {
-       
-       printk("Start schedulers\n");
-       __cli();
-       sched_timer(0);
-       smp_call_function((void *)sched_timer, NULL, 1, 1);
-       __sti();
+void schedulers_start(void) 
+{      
+    printk("Start schedulers\n");
+    __cli();
+    sched_timer(0);
+    smp_call_function((void *)sched_timer, NULL, 1, 1);
+    __sti();
 }